const Config = require('@/config/index.js');

!(function () {
    var PageTmp = Page;
    var rand = Math.random() * 100;

    Page = function (pageConfig) {
        pageConfig = Object.assign(
            {
                onShareAppMessage: function () {
                    const app = getApp();
					console.log(app.globalData.popularize_code);
                    return {
                        title: app.globalData.title + '：更多优惠的商品等您来选购哦！',
                        path: '/pages/index/index?code=' + app.globalData.popularize_code,
                        imageUrl: Config.imgUrl + '/imgs/share.png?rand=' + rand
                    };
                },
                onShareTimeline: function () {
                    const app = getApp();
					console.log(app.globalData.popularize_code);
                    return {
                        title: app.globalData.title + '：更多优惠的商品等您来选购哦！',
                        path: '/pages/index/index?code=' + app.globalData.popularize_code,
                        imageUrl: Config.imgUrl + '/imgs/share.png?rand=' + rand
                    };
                }
            },
            pageConfig
        );
        PageTmp(pageConfig);
    };
})();
